package com.blb.eduadservice.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blb.eduadservice.mapper.PromotionAdMapper;
import com.blb.eduadservice.service.PromotionAdService;
import com.blb.pojo.PromotionAd;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class PromotionAdServiceImpl extends ServiceImpl<PromotionAdMapper, PromotionAd> implements PromotionAdService {
    @Resource
    private PromotionAdMapper promotionAdMapper;

    @Cacheable(cacheNames = "promotion-ad",key = "T(String).valueOf(#id)")
    @Override
    public List<PromotionAd> getAdsBySpaceId(Long id) {
        List<PromotionAd> space_id = promotionAdMapper.selectList(new QueryWrapper<PromotionAd>().eq("space_id", id));
        return space_id;
    }

}
